﻿<phone:PhoneApplicationPage 
    xmlns:local="clr-namespace:MTGScore_Dice"
    local:TiltEffect.IsTiltEnabled="True"
    x:Class="MTGScore_Dice.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    xmlns:toolbox="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    Loaded="MainPage_Loaded"
    >


    <Grid x:Name="LayoutRoot" Background="Transparent">

        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="0" />
        </Grid.RowDefinitions>
        <!--Pivot Control-->
        <controls:Pivot Title="{Binding Path=Strings.Title, Source={StaticResource LocalizedStrings }}" Name="PivotControl">

            <!--Pivot item one-->

            <controls:PivotItem Name="DicePivot_Name" Header="{Binding Path=Strings.DiceSimulation, Source={StaticResource LocalizedStrings }}" >
                <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="137*" />
                        <RowDefinition Height="60*" />
                        <RowDefinition Height="60*" />
                        <RowDefinition Height="134*" />
                        <RowDefinition Height="103*" />
                        <RowDefinition Height="113*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="160*" />
                        <ColumnDefinition Width="160*" />
                        <ColumnDefinition Width="160*" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Grid.Row="2" Grid.Column="0" Height="40" HorizontalAlignment="Stretch" Name="TypeChooserText_1" Text="{Binding Path=Strings.DiceType1, Source={StaticResource LocalizedStrings }}" VerticalAlignment="Center" Width="152" FontSize="24" FontStretch="Expanded" FontWeight="Normal" TextAlignment="Center" >
                <toolbox:GestureService.GestureListener>
                    <toolbox:GestureListener Tap="TapDice1_Tap" />
                </toolbox:GestureService.GestureListener>
                    </TextBlock>
                    <TextBlock Grid.Row="2" Grid.Column="1" Height="40" HorizontalAlignment="Stretch" Name="TypeChooserText_All" Text="{Binding Path=Strings.EitherType, Source={StaticResource LocalizedStrings }}" VerticalAlignment="Center" Width="152" FontSize="24" FontStretch="Expanded" FontWeight="Normal" TextAlignment="Center" >
                <toolbox:GestureService.GestureListener>
                    <toolbox:GestureListener Tap="TapDiceAll_Tap" />
                </toolbox:GestureService.GestureListener>
                    </TextBlock>
                    <TextBlock Grid.Row="2" Grid.Column="2" Height="40" HorizontalAlignment="Stretch" Name="TypeChooserText_2" Text="{Binding Path=Strings.DiceType2, Source={StaticResource LocalizedStrings }}" VerticalAlignment="Center" Width="152" FontSize="24" FontStretch="Expanded" FontWeight="Normal" TextAlignment="Center"  >
                <toolbox:GestureService.GestureListener>
                    <toolbox:GestureListener Tap="TapDice2_Tap" />
                </toolbox:GestureService.GestureListener>
                    </TextBlock>

                    <!--
            
                        <TextBlock Grid.Row="2" Grid.Column="0" Height="40" HorizontalAlignment="Stretch" Name="TypeChooserText_1" Text="Scegli il dado" VerticalAlignment="Center" Width="152" FontSize="24" FontStretch="Expanded" FontWeight="Normal" TextAlignment="Center" MouseLeftButtonDown="TypeChooserText_1_MouseLeftButtonDown" />
            <TextBlock Grid.Row="2" Grid.Column="1" Height="40" HorizontalAlignment="Stretch" Name="TypeChooserText_All" Text="Scegli dadi" VerticalAlignment="Center" Width="152" FontSize="24" FontStretch="Expanded" FontWeight="Normal" TextAlignment="Center" MouseLeftButtonDown="TypeChooserText_All_MouseLeftButtonDown"/>
            <TextBlock Grid.Row="2" Grid.Column="2" Height="40" HorizontalAlignment="Stretch" Name="TypeChooserText_2" Text="Scegli il dado" VerticalAlignment="Center" Width="152" FontSize="24" FontStretch="Expanded" FontWeight="Normal" TextAlignment="Center" MouseLeftButtonDown="TypeChooserText_2_MouseLeftButtonDown" />
            
            -->

                    <Button Content="{Binding Path=Strings.Rolls1, Source={StaticResource LocalizedStrings }}" Grid.Row="4" HorizontalAlignment="Stretch" Name="Dice_1" VerticalAlignment="Stretch" Click="Dice_1_Click"/>
                    <Button Content="{Binding Path=Strings.Rolls2, Source={StaticResource LocalizedStrings }}" Grid.Row="4" Grid.Column="2" HorizontalAlignment="Stretch" Name="Dice_2" VerticalAlignment="Stretch" Click="Dice_2_Click" />
                    <Button Content="{Binding Path=Strings.Either, Source={StaticResource LocalizedStrings }}" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Stretch" Name="Dice_All" VerticalAlignment="Stretch" Click="Dice_All_Click"/>

                    <TextBlock Grid.Row="3" Height="125" HorizontalAlignment="Stretch" Name="Result_1" Text="99" VerticalAlignment="Center" Width="152" FontSize="72" FontStretch="Expanded" FontWeight="Normal" TextAlignment="Center" Margin="0,24,0,0" />
                    <TextBlock Grid.Row="3" Grid.Column="2" Height="125" HorizontalAlignment="Stretch" Name="Result_2" Text="99" VerticalAlignment="Center" Width="152" FontSize="72" FontStretch="Expanded" FontWeight="Normal" TextAlignment="Center" Margin="0,24,0,0" />

                    <Border Name="DiceBorder1" BorderThickness="3" Padding="6" Grid.Row="1" Grid.Column="0">
                        <toolbox:GestureService.GestureListener>
                            <toolbox:GestureListener Tap="GestureListener_Tap" />
                        </toolbox:GestureService.GestureListener>
                        <toolbox:ContextMenuService.ContextMenu>
                            <toolbox:ContextMenu>
                                <toolbox:MenuItem Header="4" Click="Type1_Click" />
                                <toolbox:MenuItem Header="6" Click="Type1_Click" />
                                <toolbox:MenuItem Header="10" Click="Type1_Click" />
                                <toolbox:MenuItem Header="12" Click="Type1_Click" />
                                <toolbox:MenuItem Header="20" Click="Type1_Click" />
                                <toolbox:MenuItem Header="100" Click="Type1_Click" />
                            </toolbox:ContextMenu>
                        </toolbox:ContextMenuService.ContextMenu>
                        <TextBlock Name="DiceTypeText1" Text="20"  FontSize="26" TextAlignment="Center"/>
                    </Border>

                    <Border Name="DiceBorderAll" BorderThickness="3" Padding="6" Grid.Row="1" Grid.Column="1">
                        <toolbox:GestureService.GestureListener>
                            <toolbox:GestureListener Tap="GestureListener_Tap" />
                        </toolbox:GestureService.GestureListener>
                        <toolbox:ContextMenuService.ContextMenu>
                            <toolbox:ContextMenu>
                                <toolbox:MenuItem Header="4" Click="TypeAll_Click" />
                                <toolbox:MenuItem Header="6" Click="TypeAll_Click" />
                                <toolbox:MenuItem Header="10" Click="TypeAll_Click" />
                                <toolbox:MenuItem Header="12" Click="TypeAll_Click" />
                                <toolbox:MenuItem Header="20" Click="TypeAll_Click" />
                                <toolbox:MenuItem Header="100" Click="TypeAll_Click" />
                            </toolbox:ContextMenu>
                        </toolbox:ContextMenuService.ContextMenu>
                        <TextBlock  Name="DiceTypeTextAll" Text="20"  FontSize="26" TextAlignment="Center"/>
                    </Border>

                    <Border Name="DiceBorder2" BorderThickness="3" Padding="6" Grid.Row="1" Grid.Column="2">
                        <toolbox:GestureService.GestureListener>
                            <toolbox:GestureListener Tap="GestureListener_Tap" />
                        </toolbox:GestureService.GestureListener>
                        <toolbox:ContextMenuService.ContextMenu>
                            <toolbox:ContextMenu>
                                <toolbox:MenuItem Header="4" Click="Type2_Click" />
                                <toolbox:MenuItem Header="6" Click="Type2_Click" />
                                <toolbox:MenuItem Header="10" Click="Type2_Click" />
                                <toolbox:MenuItem Header="12" Click="Type2_Click" />
                                <toolbox:MenuItem Header="20" Click="Type2_Click" />
                                <toolbox:MenuItem Header="100" Click="Type2_Click" />
                            </toolbox:ContextMenu>
                        </toolbox:ContextMenuService.ContextMenu>
                        <TextBlock  Name="DiceTypeText2" Text="20"  FontSize="26" TextAlignment="Center"/>
                    </Border>

                    <Grid Name="AdControl1" xmlns:adctl="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI" Grid.Row="0" Grid.ColumnSpan="3" >
                        <adctl:AdControl Height="80" Width="480" AdUnitId="32126" ApplicationId="6dbb89b1-2508-4665-95c4-b9870184de31" AdModel="Contextual"  AdControlError="AdControl_AdControlError" Margin="-12,0,-12,35" />
                    </Grid>
                    <Button Content="{Binding Path=Strings.OtherProducts, Source={StaticResource LocalizedStrings }}" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" Name="Ads1_Button" VerticalAlignment="Stretch" Click="Ads_Button_Click" Visibility="Collapsed" Height="100"/>
                    <Grid Name="AdControl2" xmlns:adctl="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI" Grid.Row="5" Grid.ColumnSpan="3">
                        <adctl:AdControl Height="80" Width="480" AdUnitId="32126" ApplicationId="6dbb89b1-2508-4665-95c4-b9870184de31" AdModel="Contextual" AdControlError="AdControl_AdControlError" Margin="-12,0,-12,33" />
                    </Grid>

                    <!--<Button Content="{Binding Path=Strings.OtherProducts, Source={StaticResource LocalizedStrings }}" Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" Name="Ads2_Button" VerticalAlignment="Stretch" Click="Ads_Button_Click" />-->
                </Grid>

            </controls:PivotItem>

            <controls:PivotItem Name="AdsPivot_Name" Header="{Binding Path=Strings.OtherProducts, Source={StaticResource LocalizedStrings }}" >
                <Grid>

                    <!--<phone:WebBrowser HorizontalAlignment="Left" Name="webBrowser_History" VerticalAlignment="Top" Height="424" Width="454" Visibility="Collapsed" />-->
                    <ListBox x:Name="Ads_List" Margin="0,0,-12,0" ItemsSource="{Binding Ads}" SelectionChanged="Ads_List_SelectionChanged" SelectionMode="Single" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="0,0,0,17">
                                    <Image Source="{Binding ImageUri}" Width="60" Height="60" Margin="60,0,0,0" HorizontalAlignment="Left" />
                                    <TextBlock Text="{Binding Name}" TextWrapping="NoWrap" Margin="150,-70,0,0" Width="300" Style="{StaticResource PhoneTextLargeStyle}"/>
                                    <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="150,-25,0,0" Width="300" Style="{StaticResource PhoneTextSubtleStyle}"/>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

                </Grid>

            </controls:PivotItem>


        </controls:Pivot>

        <!--<Grid Name="AdControlGrid" xmlns:adctl="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI" Grid.Row="1">
            <adctl:AdControl Name="AdControl" Height="80" Width="480" AdUnitId="32126" ApplicationId="a62110a4-daf5-481c-a39e-12e3169f10f0" AdModel="Contextual" AdControlError="AdControl_AdControlError"/>
        </Grid>-->


    </Grid>


    <!--Sample code showing usage of ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <!--<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>-->
            <shell:ApplicationBar.MenuItems>
                <!--<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>-->
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>